﻿package mortal.game.view.shopMall.shopQQ
{
    import Message.DB.Tables.*;
    import com.gengine.resource.*;
    import flash.utils.*;
    import mortal.common.global.*;
    import mortal.game.view.common.*;

    public class ShopQQConfig extends Object
    {
        private var _shopDic:Dictionary;
        private static var _instance:ShopQQConfig;

        public function ShopQQConfig()
        {
            this._shopDic = new Dictionary();
            this.init();
            return;
        }// end function

        private function init() : void
        {
            var _loc_1:* = ConfigManager.instance.getJSONByFileName("t_tencent_shop.json");
            this.write(_loc_1);
            return;
        }// end function

        private function write(param1:Object) : void
        {
            var _loc_2:TTencentShop = null;
            var _loc_3:String = null;
            var _loc_4:Object = null;
            for each (_loc_4 in param1)
            {
                
                _loc_2 = new TTencentShop();
                ClassTypesUtil.copyValue(_loc_2, _loc_4);
                _loc_3 = _loc_2.type + "_" + _loc_2.vipType;
                if (this._shopDic[_loc_3] == null)
                {
                    this._shopDic[_loc_3] = new Array();
                }
                (this._shopDic[_loc_3] as Array).push(_loc_2);
            }
            return;
        }// end function

        public function getItemListByType(param1:int, param2:int = -1) : Array
        {
            var _loc_3:int = 0;
            if (param2 == -1)
            {
                _loc_3 = ParamsConst.instance.enterType;
                if (_loc_3 == 1)
                {
                    param2 = 0;
                }
                else
                {
                    param2 = 1;
                }
            }
            return this._shopDic[param1 + "_" + param2];
        }// end function

        public static function get instance() : ShopQQConfig
        {
            if (_instance == null)
            {
                _instance = new ShopQQConfig;
            }
            return _instance;
        }// end function

    }
}
